<?php

if(isset($_POST))
{

try{  

	 $connect = new PDO('mysql:host=localhost;dbname=basketbal','cas','cas');
	 $connect->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
	 $query = "INSERT INTO video_other_visibility ( video_ID, user_key ) VALUES ( :video_ID, :user_key )";
	 $statement = $connect->prepare($query);
	 $sql_status = $statement->execute(
	  array(
	  	':video_ID'  => $_POST["video_ID"],
	   ':user_key'  => $_POST["user_key"],
	  )
	 );
	 $output = '';
	 if ($sql_status) {
	 	$unixtime = time();
	 	$time = date('Y-m-d H:i:s', $unixtime);
	 	  $output = "
	  <div class=\"alert alert-success\">
	   Visibility has been successfully saved into system at $time
	  </div>
	  ";
	 } else {
	 	$output = "<div class=\"alert alert-danger\">Something Wrong </div>";
	 }

} catch (PDOException $e) {
    
    $output = $e->getMessage();
}

 echo $output;

}

?>